package com.itheima.controller;

import com.itheima.domain.Student;
import com.itheima.service.impl.StudentService;
import com.itheima.service.impl.StudentServiceImpl;

import java.util.ArrayList;
import java.util.Scanner;

public class StudentController {
    public void start() {
        StudentService studentService=new StudentServiceImpl();
        ArrayList<Student> list = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        System.out.println();
        while (true) {
            System.out.println("- - - - - - 欢迎来到学生管理系统 - - - - - -");
            System.out.println("0.查看所有的学生");
            System.out.println("1.添加学生");
            System.out.println("2.根据学号和姓名查看学生");
            System.out.println("3.删除学生");
            System.out.println("4.修改学生");
            System.out.println("5.退出学生管理系统!");
            System.out.println("请输入您的选择:");
            String id = sc.next();
            exit:
            switch (id) {
                case "0":
                    studentService.selcetAll(list);
                    break;
                case "1":
                    studentService.addStudent(list);
                    break;
                case "2":
                    studentService.getStudent(list);
                    break;
                case "3":
                    studentService.delete(list);
                    break;
                case "4":
                    studentService.setStudent(list);
                    break;
                case "5":
                    System.out.println("- - - - - 感谢您的使用 - - - - -");
                    break exit;
                default:
                    System.out.println("不好意思,您的要求我们暂时还不能满足您,请重新输入:");
            }
        }
    }
}
